/**
 * Created by wangfan on 2017/6/9.
 */

var userTypeId=0;
var user;
var userId;

$(function () {

    $.ajax({
        url: '/commis/api/user/currentUser',
        type: "GET",
        async: false,
        dataType: 'json',
        data: {

        },
        success: function (response) {
            if (response.status==0) {
                console.log("用户存在");
                user =response.data;
                userId =user.userId;
                $("#userId").val(userId);
                userTypeId=user.userTypeId;
                if(userTypeId==4){
                    communityId=user.communityId;
                }
                console.log(userTypeId);
            } else if (response.status==1) {
                alert("登录用户已经过期，请重新登录");
                window.parent.location.href = "../../login.html";
            }
        },error: function (msg) {
            alert("登录用户已经过期，请重新登录");
            window.parent.location.href = "../../login.html";
        }
    })



    $("#save").on("click", function () {


            $.ajax({
                type: "POST",
                url:"/commis/api/user/password",
                data:$('#dataForm').serialize(),
                async: false,
                error: function(request) {
                    alert("更改密码失败，请检查填写内容是否正确");
                },
                success: function(response) {
                    //接收后台返回的结果
                    if (response.status==0) {
                        alert("修改密码成功");
                    } else if (response.status==1) {
                        alert(response.msg);
                    }

                }
            });




    });



})
//设置框架
$(function () {
    $("#page_style").frame({
        float: 'left',
        menu_nav: '.Quick_operation',
        color_btn: '.skin_select',
        Sellerber_menu: '.list_content',
        Sellerber_header: '.Sellerber_header',
    });
});
$("#iframe_box").niceScroll({
    cursorcolor: "#888888",
    cursoropacitymax: 1,
    touchbehavior: false,
    cursorwidth: "5px",
    cursorborder: "0",
    cursorborderradius: "5px"
});
/*********************/
require.config({
    paths: {
        echarts: './js/dist'
    }
});